package exp1;

import java.util.Random;
import java.util.Scanner;

public class Random3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        int maxn = (int)1e8 + 5;
        int n = sc.nextInt();
        int [] a = new int[maxn];
        for (int i = 0; i < n; i++) {
            a[i] = i + 1;
        }
        int temp, r;
        // start
        long stime = System.nanoTime();
        for (int i = 0; i < n - 1; i++) {
            r = rand.nextInt(n);
            temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
        // end
        long etime = System.nanoTime();
        for (int i = 0; i < n; i++) {
            System.out.print(a[i] + " ");
        }
        System.out.println();
        System.out.println(etime - stime);
    }
}
